<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>教师登录页面</title>
	<style>
		#err{
			color:red;
		}
	</style>

</head>
<body style="background:url(http://dxyqsblz.hbu.cn/images/login/images/login_bg.png) no-repeat;background-size:100%;">
<%--	<form action="<%=request.getContextPath() %>/qjxt/login_teacher" method="post" style="width:300px;height:200px;margin-top:300px;margin-left:800px;position:absolute;">--%>
		<div style="width:300px;height:200px;margin-top:300px;margin-left:800px;position:absolute;">
			<p style="color:#4252d6;font-size: 25px;margin-bottom: 0;">教师登录</p><br />
			用户名：<input type="text" name="account" id="name" placeholder="请输入用户名" style="background: #fff;width:200px;border:1px solid #333;height:30px;text-indent:10px;" /><br />
			密　码：<input type="password" name="password" id="pwd" placeholder="请输入密码" style="margin-top:10px;background: #fff;width:200px;border:1px solid #333;height:30px;text-indent:10px;" /><br />
			<input type="button" value="登录" style="background-color:blue;width:268px;text-align:center;height:35px; border:1px solid #333;margin-top:20px;color:#fff;font-size:16px;" onclick="newuser()" />
		</div>
		<div id="err">

		</div>
<%--	</form>--%>
</body>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
	<script type="text/javascript">

		function newuser(){

			var param = {
				"account":$("#name").val(),
				"password":$("#pwd").val()
			}
			$.ajax({
				type:"post",
				url:"http://localhost:8080/ssm/qjxt/login_teacher",
				data:param,
				//cache:false, //表示浏览器是否缓存被请求页面,默认是 true。
				//async:false, //表示请求是否异步处理,默认是 true。
				//dataType:JSON
				success:function (data) {
					alert("登录成功");
					// $("#err").html(data);
					window.setTimeout(function(){
						window.location.href="http://localhost:8080/ssm/qjxt/main";
					},500);
				},
				error:function (XMLHttpRequest, textStatus, errorThrown) {
					alert("登录失败：账号或密码错误");
				}
			});
		}

	</script>
</html>